package core.input;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import data.entity.player.Player;

public class TestModeKeyListener implements KeyListener{
	
	private Player player;
	
	public TestModeKeyListener(Player p){
		player = p;
	}

	@Override
	public void keyTyped(KeyEvent e) {
		
	}

	@Override
	public void keyPressed(KeyEvent e) {
		int i = e.getKeyCode();
		if (i == KeyEvent.VK_LEFT)
			moveLeft();
		else if (i == KeyEvent.VK_RIGHT)
			moveRight();
		else if (i == KeyEvent.VK_UP)
			moveUp();
		else if (i == KeyEvent.VK_DOWN)
			moveDown();
	}

	private void moveDown() {
		player.getRectangle().y = player.getRectangle().y + player.getSpeed();
		
	}

	private void moveUp() {
		player.getRectangle().y = player.getRectangle().y  - player.getSpeed();
		
	}

	private void moveRight() {
		player.getRectangle().x = player.getRectangle().x  + player.getSpeed();
		
	}

	private void moveLeft() {
		player.getRectangle().x = player.getRectangle().x - player.getSpeed();
		
	}

	@Override
	public void keyReleased(KeyEvent e) {
		
	}

}
